<?php

include_once("../class/db.php");
$handler = new db();

$action 				= mysql_real_escape_string($_POST['action']); 
$updateRecordsArray 	= $_POST['recordsArray'];

if ($action == "updateRecordsListings"){
	
	$listingCounter = 1;
	foreach ($updateRecordsArray as $recordIDValue) {
		
		$sql = "UPDATE course_content SET order_number = " . $listingCounter . " WHERE id = " . $recordIDValue;
		$handler->execute($sql, "none");
		$listingCounter = $listingCounter + 1;	
	}
}
?>